cmake_minimum_required(VERSION 3.5)

project(falcon LANGUAGES CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# QtCreator supports the following variables for Android, which are identical to qmake Android variables.
# Check http://doc.qt.io/qt-5/deployment-android.html for more information.
# They need to be set before the find_package(Qt5 ...) call.

#if(ANDROID)
#    set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
#    if (ANDROID_ABI STREQUAL "armeabi-v7a")
#        set(ANDROID_EXTRA_LIBS
#            ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libcrypto.so
#            ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libssl.so)
#    endif()
#endif()

find_package(Qt5 COMPONENTS Widgets LinguistTools REQUIRED)

#set(TS_FILES falcon_uml.zh_CN.ts)
set(RC_FILES falcon_uml.qrc)

include(include/falcon/falcon.cmake)

include(src/runtime/runtime.cmake)
include(src/facade/facade.cmake)
include(src/model/model.cmake)
include(src/style/style.cmake)
include(src/ui/ui.cmake)

#set(falcon_uml_RCCS falcon_uml.qrc)
#QT5_ADD_RESOURCES(falcon_uml_RCC_SRCS ${falcon_uml_RCCS})

if (ANDROID)
    add_library(falcon SHARED
            main.cpp
            MainWindow.cpp
            MainWindow.h
            ${RC_FILES}
            ${SOURCES}
            ${HEADERS}
            ${TS_FILES}
            )
else ()
    add_executable(falcon
            main.cpp
            ${RC_FILES}
            ${SOURCES}
            ${HEADERS}
            ${TS_FILES}
            )
endif ()


set_target_properties(falcon PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/bin)

target_link_libraries(falcon PRIVATE Qt5::Widgets)
target_include_directories(falcon PRIVATE ${INCLUDEPATH} ${CMAKE_CURRENT_LIST_DIR}/include ${CMAKE_CURRENT_LIST_DIR}/src)

qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
